home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstdio.arc / SRC.ARC / INDEX.C < prev    next >
C/C++ Source or Header  |  1984-07-29  |  374b  |  16 lines

  1. /*    index.c - find first occurrence of character in string.
  2.     (C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
  3.     G. R. Mansfield.  84/06/06.
  4.     Ver 1.0-4729.
  5. */
  6.  
  7. #include <defstd.h>
  8.  
  9. char *index(s, c)    /* return pointer to first occurrence of c in s */
  10. char *s, c;    /* NULL if c is not in s */
  11. {
  12.     while (*s && *s != c)
  13.         s++;
  14.     return(*s ? s : NULL);
  15. }
  16.